//
//  TouTiaoViewController.m
//  GXWN
//
//  Created by 要帅气的生活 on 15/11/5.
//  Copyright © 2015年 UNOHACHA. All rights reserved.
//

#import "TouTiaoViewController.h"
#import "TouTiaoTableViewCell.h"
#import "TouTiaoXiangQingViewController.h"
#import "Head.h"

@interface TouTiaoViewController ()<UITableViewDataSource,UITableViewDelegate>

@property (nonatomic,retain) UITableView *table;

@end

@implementation TouTiaoViewController
- (void)viewWillAppear:(BOOL)animated{
    self.navigationController.navigationBar.hidden = NO;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    //self.navigationItem.leftBarButtonItem = [UIBarButtonItem alloc] initWithImage:<#(nullable UIImage *)#> style:<#(UIBarButtonItemStyle)#> target:<#(nullable id)#> action:<#(nullable SEL)#>
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(left)];
    self.navigationItem.title = @"头条";
    
    self.table = [[UITableView alloc] initWithFrame:self.view.frame];
    [self.view addSubview:self.table];
    self.table.dataSource = self;
    self.table.delegate = self;
    [self.table registerClass:[TouTiaoTableViewCell class] forCellReuseIdentifier:@"tou"];
    self.table.rowHeight = 280;
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 10;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    TouTiaoTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"tou"];
    return cell;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    TouTiaoXiangQingViewController *xiangqing = [[TouTiaoXiangQingViewController alloc] init];
    [self.navigationController pushViewController:xiangqing animated:YES];
    xiangqing.view.backgroundColor = [UIColor whiteColor];
}

-(void)left
{
    [self.navigationController popViewControllerAnimated:YES];
    self.navigationController.navigationBarHidden = YES;
}
@end
